'use strict';

const Controller = require('egg').Controller;

class ListController extends Controller {
    async getlist() {
        const { ctx } = this;
        const {pageIndex,pageSize}=ctx.query
        const results = await this.app.mysql.query(`SELECT * FROM shop LIMIT ${pageIndex},${pageSize}`);
        const total=await this.app.mysql.query(`SELECT * FROM shop`)
        if(results){
            ctx.body={
                code:200,
                data:results,
                total:total.length
            }
        }else{
            ctx.body={
                code:403,
                mes:'查询失败'
            }
        }
    }
    async editlist(){
        const { ctx } = this;
    }
    async dellist(){
        const { ctx } = this;
    }
}

module.exports = ListController;
